Skip to content

Dial9 viewer#177

Merged
rcoh merged 8 commits into
mainfrom
dial9-viewer
Apr 9, 2026
Merged

Dial9 viewer#177
rcoh merged 8 commits into
mainfrom
dial9-viewer

Conversation

@rcoh

@rcoh rcoh commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

This adds a minimal CLI tool that hosts a frontend / backend to allow serving files from S3 directly to the viewer. The UI is really minimal right now, I have a lot of plans to improve it but right now it just shows the files, offers a really basic search bar and lets you open the files in dial9.
Screenshot 2026-04-09 at 4 19 38 PM

rcoh added 6 commits April 9, 2026 19:20
Move index.html, trace_parser.js, test_parser.js, demo-trace.bin,
and decode.js symlink from dial9-tokio-telemetry/trace_viewer/ to
dial9-viewer/ui/ in preparation for the dial9-viewer crate.

Update all references: netlify.toml, .gitignore, AGENTS.md,
regenerate_demo_trace.sh, js_parser.rs, format_comparison.rs,
README.md, and serve.py.
New crate: dial9-viewer — a CLI that serves the trace viewer UI and
provides API endpoints for browsing S3 trace storage.

- CLI with clap: --port, --bucket, --prefix, --ui-dir
- Axum server serving static files from ui/ directory
- StorageBackend trait (dyn-compatible) with S3Backend impl
- GET /api/search?q=prefix&bucket=b — list objects by prefix
- GET /api/trace?keys=k1,k2&bucket=b — fetch, gunzip, concat traces
- Placeholder browser.html
- serve.py for UI-only dev iteration
- Integration tests for static file serving and API validation
- StorageBackend trait (dyn-compatible) for future pluggable backends
- S3Backend: list_objects with pagination, get_object with error handling
- GET /api/search: prefix-based S3 listing, supports default bucket/prefix
- GET /api/trace: fetches multiple keys, gunzips, concatenates, 50MB cap
- 9 integration tests including s3s-fs backed e2e tests
- 583 stress iterations with zero failures
Self-contained HTML page (inline CSS/JS, no build step) with:
- Bucket input and search prefix text box
- Results table with checkbox multi-select
- Select All / Deselect All buttons
- "View Selected in Trace Viewer" opens index.html?trace=/api/trace?...
- Pre-fills bucket/prefix from URL params
- Dark theme matching the existing trace viewer
Exercises the complete browser flow against s3s-fs:
1. Upload gzipped trace segments
2. Search via /api/search
3. Build trace URL from search results (like browser.html does)
4. Fetch concatenated trace via /api/trace
5. Verify both segments present in output
@rcoh rcoh force-pushed the dial9-viewer branch 2 times, most recently from a83a5ad to 0618e51 Compare April 9, 2026 19:54
- dev-server: starts s3s fake S3, seeds with demo trace data, runs
  the viewer pointed at it. Useful for manual testing.
- Fix: decompress demo-trace.bin before re-gzipping segments to
  avoid double-gzip that broke the viewer's JS decompression.
- Add console.log tracing to the viewer's loadTraceFromUrl path
  for easier debugging of trace loading issues.
@rcoh rcoh requested a review from jlizen April 9, 2026 20:21
@rcoh rcoh marked this pull request as ready for review April 9, 2026 20:22

@jlizen jlizen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good start, some nits, fine as follow ups

Comment thread dial9-viewer/src/server/trace.rs Outdated
.or(state.default_bucket.clone())
.ok_or((StatusCode::BAD_REQUEST, "bucket is required".to_string()))?;

let keys: Vec<&str> = params.keys.split(',').filter(|k| !k.is_empty()).collect();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: commas are legal in s3 keys, consider multiple query params or a json array or something

Comment thread dial9-viewer/src/server/trace.rs Outdated

let mut combined = Vec::new();

for key in &keys {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this is fetching sequentially, probably better to join_all them (or use transfer manager or something)

}

#[derive(Debug)]
pub enum StorageError {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: better to preserve source, or at least use DisplayErrorContext

/// Dev helper: starts an s3s fake S3 server, seeds it with test trace data,
/// then starts the dial9-viewer pointed at it.
///
/// Usage: cargo run -p dial9-viewer --bin dev-server

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: probably make port overrideable

rcoh added a commit that referenced this pull request Apr 9, 2026
- trace.rs: Use repeated query params (?keys=a&keys=b) instead of
  comma-separated, since commas are legal in S3 keys
- trace.rs: Fetch S3 objects concurrently with join_all instead of
  sequentially
- storage.rs: Use DisplayErrorContext for S3 errors to preserve the
  full error chain
- dev_server.rs: Make port overrideable via PORT env var
- Update browser.html, tests, and README to match new keys format
rcoh added a commit that referenced this pull request Apr 9, 2026
- trace.rs: Use repeated query params (?keys=a&keys=b) instead of
  comma-separated, since commas are legal in S3 keys
- trace.rs: Fetch S3 objects concurrently with join_all instead of
  sequentially
- storage.rs: Use DisplayErrorContext for S3 errors to preserve the
  full error chain
- dev_server.rs: Make port overrideable via PORT env var
- Update browser.html, tests, and README to match new keys format
- trace.rs: Use repeated query params (?keys=a&keys=b) instead of
  comma-separated, since commas are legal in S3 keys
- trace.rs: Fetch S3 objects concurrently with join_all instead of
  sequentially
- storage.rs: Use DisplayErrorContext for S3 errors to preserve the
  full error chain
- dev_server.rs: Make port overrideable via PORT env var
- Update browser.html, tests, and README to match new keys format
@rcoh rcoh added this pull request to the merge queue Apr 9, 2026
Merged via the queue into main with commit 8454811 Apr 9, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants